
<?php
 include "../controller/load_ttcn.php";
 while ($row = mysql_fetch_assoc($kq_ttcn)){
    $id_nv = $row['id_NhanVien'];
    $pass =$row['MatKhau'];
    $hoTen =$row['HoTen'];
    $goitinh=$row['GioiTinh'];
    $ngaySinh=$row['NgaySinh'];
    $diaChi = $row['DiaChi'];
    $dienThoai=$row['DienThoai'];
    $mail=$row['Email'];
    $ngayBDLV=$row['NgayBDLV'];
    $mucluong=$row['Luong'];
    $ghiChu=$row['GhiChu'];
    $manguoiQL=$row['MaNQL'];
    $vaiTro = $row['MaVaiTro'];
    $noiSinh = $row['NoiSinh'];
    $phongLV= $row['MaPhong'];
    $tinhTrang = $row['MaTinhTrang'];
    $ngay_cnttcn = $row['ngaycapnhat'];
    
 }
?>
    <div id="caidat">
        <div class="formHeader">
            <p> Sửa Thông Tin Cá Nhân</p>
        
        </div>
        <div id="formContent">
            <form action="../controller/xuly_capnhat_ttcn.php" enctype="multipart/form-data" method="post" id="frmTTCN" name="frmTTCN">
                <table cellspacing = 0 cellpadding =0>
                    <tr>
                        <td align="right">ID Nhân Viên</td>
                        
                        <td>
                            <input type="text" size="30" id="txt_idNhanVien" name="txt_idNhanVien" readonly="true" value="<?php echo $id_nv; ?>" />
                        </td>
                    
                    </tr>

                    <tr>
                        <td align="right">Mật Khẩu</td>
                        
                        <td>
                            <input type="password" size="30" id="txtMatKhau" name="txtMatKhau" value="<?php echo $pass; ?>"/>
                        </td>
                    
                    </tr>
                    
                    <tr>
                        <td align="right">Họ và Tên</td>
                        
                        <td>
                            <input type="text" size="30" id="txtHoTen" name="txtHoTen" value="<?php echo $hoTen; ?>" style="font-weight: bold;"/>
                        </td>
                    
                    </tr>
                    <tr>
                        <td align="right">Thêm hình ảnh</td>
                        <td><input type="file" name="hinhnv" /></td>
                    </tr>
                    
                    <tr>
                        <td align="right">Giới Tính</td>
                    
                    <?php


                        $sql_load_gioitinh = "select GioiTinh from chitietnhanvien where id_NhanVien = '$id_nv' ";
                        $kq_gioitinh = executeQuery($sql_load_gioitinh);
                        
                        echo "<td>
                            <select name='gioitinh'>";
                            
                        while ($gt = mysql_fetch_array($kq_gioitinh)) { 
                        $gt_select=$gt['GioiTinh'];
                        echo "
                            <option value = 'Nam'"; 
                            
                            if ($gt_select=='Nam'){echo "selected='true'";}
                            
                            echo ">Nam</option>";
 
                            echo "<option value = 'Nữ'"; 
                                
                                if ($gt_select=='Nữ'){echo "selected='true'";}
                                
                                echo ">Nữ</option>";
                                
                                }
                            
                            echo"</select></td>";
                        
                        
                    ?>
                    </tr>
                    
                    <tr>
                        <td align="right">Ngày Sinh</td>
                        
                        <td>
                            <input type="text" size="30" id="txtNgaySinh" name="txtNgaySinh" value="<?php echo $ngaySinh; ?>"/>
                        </td>
                    
                    </tr>
                    
                    <tr>
                        <td align="right">Nơi Sinh</td>
                        
                        <td>
                            <input type="text" size="30" id="txtNoiSinh" name="txtNoiSinh" value="<?php echo $noiSinh; ?>"/>
                        </td>
                    
                    </tr>
                    
                    <tr>
                        <td align="right">Địa Chỉ</td>
                        
                        <td>
                            <input type="text" size="30" id="txtDiaChi" name="txtDiaChi" value="<?php echo $diaChi; ?>"/>
                        </td>
                    
                    </tr>
                    
                    <tr>
                        <td align="right">Điện Thoại</td>
                        
                        <td>
                            <input type="text" size="30" id="txtDienThoai" name="txtDienThoai" value="<?php echo $dienThoai; ?>"/>
                        </td>
                    
                    </tr>
                    
                    <tr>
                        <td align="right">Email</td>
                        
                        <td>
                            <input type="text" size="30" id="txtEmail" name="txtEmail" value="<?php echo $mail; ?>"/>
                        </td>
                    
                    </tr>
                    
                    <tr>
                        <td align="right">Ngày Bắt Đầu LV</td>
                        
                        <td>
                            <input type="text" size="30" id="txtNgayBDLV" name="txtNgayBDLV" value="<?php echo $ngayBDLV; ?>"/>
                        </td>
                    
                    </tr>
                    
                    <tr>
                        <td align="right">Vai Trò</td>
                    
                    <?php

                        //include "../util/dataUtil.php";
                        $sql_load_vaitro = "select * from vaitro";
                        $kq_vaitro = executeQuery($sql_load_vaitro);
                        
                        echo "<td>
                            <select name='vaitro'>";
                            
                        while ($vt = mysql_fetch_array($kq_vaitro)) {   
                        echo "
                            <option value = '".$vt_select=$vt['id']."'"; 
                            
                            if ($vt_select['id']==$vaiTro){echo "selected='true'";}
                            
                            echo ">".$vt_select=$vt['TenVaiTro']."</option>";
                            
                            }
                        
                        echo"</select></td>";
                        
                        
                        
                    ?>
                    </tr>
                    
                    <tr>
                        <td align="right">Phòng Ban</td>
                    
                    <?php

                        //include "../util/dataUtil.php";
                        $sql_load_maphong = "select * from phongban";
                        $kq_maphong = executeQuery($sql_load_maphong);
                        
                        echo "<td>
                            <select name='maphong'>";
                            
                        while ($mp = mysql_fetch_array($kq_maphong)) {
                            $mp_select =  $mp['MaPhong']; 
                            $tenphong = $mp['TenPhong'];  
                        echo "
                            <option value = '$mp_select'"; 
                            
                            if ($mp_select==$phongLV){echo "selected='true'";}
                            
                            echo ">$tenphong</option>";
                            
                            }
                        
                        echo"</select></td>";
                        
                        
                        
                    ?>
                    
                    </tr>
                    
                    <tr>
                        <td align="right">Tình Trạng</td>
                    
                    <?php

                        //include "../util/dataUtil.php";
                        $sql_load_tinhtrang = "select * from tinhtrang";
                        $kq_tinhtrang = executeQuery($sql_load_tinhtrang);
                        
                        echo "<td>
                            <select name='tinhtrang'>";
                            
                        while ($tt = mysql_fetch_array($kq_tinhtrang)) {   
                        echo "
                            <option value = '".$tt_select=$tt['id']."'"; 
                            
                            if ($tt_select['id']==$tinhTrang){echo "selected='true'";}
                            
                            echo ">".$tt_select=$tt['TinhTrang']."</option>";
                            
                            }
                        
                        echo"</select></td>";
                        
                        
                        
                    ?>
                    
                    </tr>
                    
                    <tr>
                        <td align="right">Người Quản Lý</td>

                        <?php

                        $sql_load_idnv = "select id_NhanVien from nhanvien";
                        $kq_idnv = executeQuery($sql_load_idnv);
                        
                        echo "<td>
                            <select name='txtMaNQL'>";
                            
                        while ($rowid = mysql_fetch_array($kq_idnv)) {   
                        echo "
                            <option value = '".$rowid['id_NhanVien']."'"; 
                            
                            if ($rowid['id_NhanVien']==$manguoiQL){echo "selected='true'";}
                            
                            echo ">".$rowid['id_NhanVien']."</option>";
                            
                            }
                        
                        echo"</select></td>";
                        
                        
                        
                    ?>
                    </tr>
                    
                    <tr>
                        <td align="right">Mức Lương</td>
                        <td>
                            <input type="text" size="30" id="txtMucLuong" name="txtMucLuong" value="<?php echo $mucluong; ?>"/>
                        </td>
                    
                    </tr>
                   
                    
                    <tr>
                        <td align="right">Ghi Chú</td>
                        <td>
                            <input type="text" size="30" id="txtGhiChu" name="txtGhiChu" value="<?php echo $ghiChu; ?>"/>
                        </td>
                    
                    </tr>
                    <tr>
                        <td align="right" colspan="3">Ngày cập nhật thông tin gần nhất: <font style="color: #FF8040;"><?php echo " ".$ngay_cnttcn; ?></font>
                        </td>
                    
                    </tr>                     
                    
                    <tr>
                        <td colspan="3" align ="center">
                            <input type="submit" value="Lưu Lại" id="themMoi" name="themMoi"/>
                            <input type="reset" value="Nhập Lại" id="nhapLai" name="nhapLai"/>
                        </td>
 
                    </tr>
                    
                </table>
            </form>
        </div>
    </div>
